Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: custom error message #68

Merged
merged 5 commits into from
Mar 14, 2023
Merged

feat: custom error message #68

merged 5 commits into from
Mar 14, 2023

Conversation

sarike
Copy link
Contributor

@sarike sarike commented Jun 22, 2019

closes #31
closes #15

所有的 rule 中添加字段 “message",可以自定义错误信息,完全向前兼容。

rule 示例:

{
    type: 'int', 
    max: 200,
    message: {
        max: '年龄不能大于 200 岁',
        required: '请填写你的年龄'
    }
}
{
    type: 'email', 
    message: {
        email: '邮箱格式不正确',
        required: '前输入您的邮箱'
    }
}

@codecov
Copy link

codecov bot commented Jun 22, 2019

Codecov Report

Merging #68 (a92edfc) into master (12c51b3) will increase coverage by 0.02%.
The diff coverage is 100.00%.

❗ Current head a92edfc differs from pull request most recent head 6eafddc. Consider uploading reports for the commit 6eafddc to get more accurate results

@@            Coverage Diff             @@
##           master      #68      +/-   ##
==========================================
+ Coverage   99.53%   99.55%   +0.02%     
==========================================
  Files           1        1              
  Lines         213      226      +13     
  Branches       81       89       +8     
==========================================
+ Hits          212      225      +13     
  Misses          1        1              
Impacted Files Coverage Δ
index.js 99.55% <100.00%> (+0.02%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@proc07
Copy link

proc07 commented Oct 10, 2019

@sarike hi,为什么你commits的代码,没有在外面的 index.js 中展示呢

@MrZhang123
Copy link

这个不给合并吗?默认的报错信息让用于很困惑

@Redtwodog
Copy link

为什么这个feature不合并啊。自定义message确实很重要。

@li305263
Copy link

li305263 commented Jul 8, 2020

还没合并吗..

@denghongcai
Copy link

@sarike 能否更新下 README 并且 rebase master

逻辑 LGTM

@Lastly1999
Copy link

赶紧合并啊...这个功能必须有的

@fengmk2 fengmk2 changed the title feat: custom error message #15 #31 feat: custom error message Mar 14, 2023
@socket-security
Copy link

socket-security bot commented Mar 14, 2023

Socket Security Pull Request Report

👍 No dependency changes detected in pull request

Pull request report summary
Issue Status
Install scripts ✅ 0 issues
Native code ✅ 0 issues
Bin script shell injection ✅ 0 issues
Unresolved require ✅ 0 issues
Invalid package.json ✅ 0 issues
HTTP dependency ✅ 0 issues
Git dependency ✅ 0 issues
Potential typo squat ✅ 0 issues
Known Malware ✅ 0 issues
Telemetry ✅ 0 issues
Protestware/Troll package ✅ 0 issues

Powered by socket.dev

@fengmk2 fengmk2 merged commit 818cd23 into node-modules:master Mar 14, 2023
fengmk2 pushed a commit that referenced this pull request Mar 14, 2023
[skip ci]

## [3.7.0](v3.6.0...v3.7.0) (2023-03-14)

### Features

* custom error message ([#68](#68)) ([818cd23](818cd23)), closes [#31](#31) [#15](#15)
@github-actions
Copy link

🎉 This PR is included in version 3.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

能不能自定义message啊 无法自定义message?
8 participants